//
//  ViewController.m
//  AudioWaveDemo
//
//  Created by ilongge on 2023/4/17.
//

#import "ViewController.h"
#import "XLSampleDataProvider.h"
#import "XLWavefromView.h"
#import "XLAudioSpectrumPlayer.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIView *domainView;
@property (nonatomic, strong) XLWavefromView *waveRenderView;
@property (nonatomic, strong) XLSampleDataProvider *domainTool;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.waveRenderView = [[XLWavefromView alloc] init];
    [self.domainView addSubview:self.waveRenderView];
    self.domainTool = [[XLSampleDataProvider alloc] init];
}

- (void)viewWillLayoutSubviews
{
    [super viewWillLayoutSubviews];
    
}

- (IBAction)timeDomainAction:(UIButton *)sender {
    
    self.waveRenderView.frame = CGRectMake(0, 0, self.domainView.frame.size.width, self.domainView.frame.size.height);
    NSString *audioPath = [[NSBundle mainBundle] pathForResource:@"小飞机的故事" ofType:@"mp3"];
    NSURL *audioUrl = [NSURL fileURLWithPath:audioPath];
    self.waveRenderView.audioUrl = audioUrl;
    self.waveRenderView.waveColor = [UIColor redColor];
    [self.waveRenderView startShowWace];
}

- (IBAction)frequencyDomainAction:(UIButton *)sender {
    
    
    self.waveRenderView.frame = CGRectMake(0, 0, self.domainView.frame.size.width, self.domainView.frame.size.height);
    NSString *audioPath = [[NSBundle mainBundle] pathForResource:@"陈少华-九九女儿红.1995" ofType:@"mp3"]; 

}

@end
